
//禁止下载文件hook
import { useEventListener } from '@vueuse/core';

export const useBanDownLoadFile = () => {
  // 禁用鼠标右键
  useEventListener(window, 'contextmenu', (e) => {
    console.log('点击右键了')
    e.preventDefault();
  });

  // 禁用 F12 键
  useEventListener(window, 'keydown', (e) => {
    if (e.key === 'F12') {
      console.log('点击F12了')
      e.preventDefault();
    }
  });


  // 禁用 Ctrl + Shift + I
  useEventListener(window, 'keydown', (e) => {
    if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.key === 'I') {
      console.log('点击Ctrl + Shift + I了');
      e.preventDefault();
    }
  });

  // 禁用 Ctrl + Shift + J
  useEventListener(window, 'keydown', (e) => {
    if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.key === 'J') {
      console.log('点击Ctrl + Shift + J了');
      e.preventDefault();
    }
  });

  // 禁用 Ctrl + U
  useEventListener(window, 'keydown', (e) => {
    if ((e.ctrlKey || e.metaKey) && e.key === 'U') {
      console.log('点击Ctrl + U了');
      e.preventDefault();
    }
  });
}